---
title: Toast
description: A succinct message that is displayed temporarily.
kobalte: https://kobalte.dev/docs/core/components/toast
---

<ComponentPreview name="toast-demo" />

## Installation

<Tabs defaultValue="cli">

<TabsList>
  <TabsTrigger value="cli">CLI</TabsTrigger>
  <TabsTrigger value="manual">Manual</TabsTrigger>
</TabsList>

<TabsContent value="cli">

```bash
npx solidui-cli@latest add toast
```

</TabsContent>

<TabsContent value="manual">
<Steps>

<Step>Install the following dependencies: </Step>

```bash
pnpm install @kobalte/core solid-icons
```

<Step>Copy and paste the following code into your project: </Step>

<ComponentSource name="toast" />

</Steps>
</TabsContent>

</Tabs>

## Usage

### Toaster

The `<Toaster />` component is where your toasts are displayed. You can place it anywhere in your app, but it's recommended to place it at the root of your app.

```tsx
import { Toaster } from "~/components/ui/toast"
```

```tsx
<html>
  <body>
    <main>{children}</main>
    <Toaster />
  </body>
</html>
```

### showToast()

The `showToast` function creates a `<Toast />` component that is shown using the `<Toaster />` component, that was set up above.

```tsx
import { showToast } from "~/components/ui/toast"
```

```tsx
<Button
  onClick={() =>
    showToast({ title: "Event added.", description: "Friday, February 10, 2023 at 5:57 PM" })
  }
>
  Show Toast
</Button>
```
